HUNDREDS of bright blue T-shirts with the slogan “smile” pass down a row of tables where they are inspected, folded, bagged and tagged. From here they will embark on an arduous journey of more than 1,000km (600 miles). A lorry will haul them from Kampala, Uganda’s capital, across Kenya to the port of Mombasa. A week later they will be loaded onto a ship for Hamburg, Germany. There they will be sold for €10 ($11) each by Bonprix, part of a family-owned mail-order firm with sales of $13bn a year.

These shirts began as cotton bolls in fields on the equator in the far west of Uganda, where the red-earth plains turn upwards into the Rwenzori mountains. Their odyssey reveals much about Africa’s manufacturing potential. By following in the footsteps of China and Bangladesh, which began their industrial revolutions with textiles, Africa could in theory create millions of jobs. But as the T-shirts’ travels also illustrate, it will not be easy.

Several African countries have tried in the past to become tailors and cloth-makers to the world. Nigeria’s northern cities of Kaduna and Kano were once home to textile mills that employed 350,000 people. Yet these factories are now rusting, and employ perhaps a tenth of that number.

This mirrors a wider trend. In 1990 African countries accounted for about 9% of the developing world’s manufacturing output. By 2014 that share had slumped to 4%. As the world’s labour-intensive jobs left the rich world for countries with lower wages, Africa lost out to Asia because of bad governance, political instability and poor infrastructure. Another shift of similar proportions now seems in the offing as China grows richer. But there are some signs that, this time, Africa might catch the wave of industrialisation.

In the shade of a large tree just a few kilometres from Uganda’s border with the Democratic Republic of Congo, a group of farmers have gathered to discuss their bumper cotton crop and the obstacles they had to overcome to grow it. Elephants sometimes rampage out of a nearby game reserve and trample the neat rows of cotton, they complain. They plant barriers of chili peppers and keep beehives to keep the jumbos out.

Markets are even less predictable than pachyderms. All the farmers at this meeting are tenants who rent small plots. “When the price of cotton goes up, so does the rent we pay,” says one woman bitterly. African farmers, who use ox-drawn ploughs and pick cotton by hand, are competing against vast mechanised farms in Texas that still receive subsidies. About 80% of Uganda’s cotton is exported, but because its fields are far inland and the cotton has to travel over rutted roads past rapacious officials, the price these farmers receive is only 60-70% of the international benchmark for delivery to Asia, a lower share than goes to American farmers.

Yet the Ugandan farmers’ income is rising because of two changes further along the chain between shrub and shirt. One occurs at the ginnery, where huge clumps of seed-studded fluff are shovelled into gigantic machines that clean and comb them. At the entrance, two officials of the government’s Cotton Development Organisation diligently record each sale in order to tax it. The money goes back into buying good seeds and pesticides that are then given to farmers. New seeds introduced from Zimbabwe last year produce bolls that yield about a third more usable cotton than the old variety.

Better farming techniques also help. Western Uganda Cotton Company (WUCC), a ginnery with British shareholders, is trying to get more of the fluffy stuff by training farmers about when to weed and how to space out the seeds as they plant. Those who follow these instructions have seen their yields double to about 600kg an acre (twice as much as farmers in America manage—a testament to Uganda’s fertile soil). “I will double my cotton planting next year,” says Joshua, a middle-aged man. But farmers face huge hurdles in doing so, even though there is plenty of land available. One says that after setting aside money for her children’s school fees she will have enough left to rent only a single acre again next year. Borrowing is not an option. Bank loans are too expensive and cheap ones from government agencies are wrapped in red tape.

Although Uganda still exports most of its cotton, the bags of lint emerging from WUCC’s ginnery are trucked to Fine Spinners Uganda, a factory in Kampala that turns them into clothing. Because the factory is so close to the fields, the cotton it buys costs much less than it would in Asia, giving it a small advantage over competitors from places such as Bangladesh, the world’s second-largest clothing exporter.

In this plant employees gingerly open the bales of lint and feed the cotton into an assortment of machines that first spin it into yarn, then knit it into cloth and dye it. Then the fabric follows an orderly procession past long lines of work stations where it is cut and then stitched back together. Colourful designs are printed onto the finished shirts. Some will be flown out to California to be sold by EDUN, a clothing brand started by Ali Hewson, an Irish businesswoman, and Bono, her rock-star husband. Others are for sale in a local market that has been squeezed by imports of second-hand clothing. The rest are destined for Europe, where they will have to compete on price with imports from Asia.

Uganda’s main advantages, for the moment, are cheap cotton and labour, and preferential access to American and European markets. When exporting to the rich world “Africa has an 18-35% duty advantage over any other continent”, says Nick Earlham, a shareholder in WUCC and in Fine Spinners. “It’s very competitive.”

Textile workers in Kampala earn about $85 a month, compared with $150 in Kenya and $108 in Vietnam, never mind up to $700 in China. But these savings are offset by problems in almost every other sphere. Power cuts keep plunging the factory into darkness, and an erratic supply of steam to the dyeing machines makes it hard to ensure that each batch of fabric looks alike.

In a cramped meeting room alongside the factory, executives of Bonprix visiting from Europe make their unhappiness clear. Their inspectors in Hamburg are discovering more defects than they would like, and one big shipment of T-shirts will be unexpectedly late. “What would happen if this item was on the cover of our catalogues?” one asks.

Yet for all the tough talk, Bonprix is placing orders at higher prices than it might pay elsewhere and offering technical help to nurture an industry which it hopes will, in time, become competitive. As its rivals look to countries such as Vietnam and Bangladesh, which are starting to replace China as big suppliers of clothing, Bonprix is already seeking out the countries that will, in turn, replace them. “East Africa has a lot of potential to develop a strong textile and garment industry,” says Rien Jansen of Bonprix. As Asia grows richer, its pool of cheap labour will eventually run dry—and Africa is next in line.